package org.zfes.snowier.zbss.xzy.router.zmd;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.zfes.snowier.core.data.DataSet;
import org.zfes.snowier.web.controller.BaseController;
import org.zfes.snowier.zbss.xzy.biz.zmd.model.ModataDisk;
import org.zfes.snowier.zbss.xzy.biz.zmd.service.IModataDiskService;
import org.zfes.snowier.core.data.SelectVo;
@Controller 
@RequestMapping("/xzy")
public class ModataDiskController implements BaseController {

	
	@Autowired
	private IModataDiskService modataDiskService;
	
	//@RequiresPermissions(value="modataDisk:loadModataDiskDataSet",desc="监控磁盘列表")
    @RequestMapping(value="/loadModataDiskDataSet", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
    public @ResponseBody  Object loadModataDiskDataSet(@RequestBody Map<String,Object> params){
	    DataSet dataSet=  modataDiskService.loadModataDiskDataSet(params);
	    return ajaxQuery("dataSet", dataSet);
    }
	
	//@RequiresPermissions(value="modataDisk:createModataDisk",desc="监控磁盘添加")
    @RequestMapping(value="/createModataDisk", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
    public  @ResponseBody Object createModataDisk(@RequestBody ModataDisk modataDisk){
		modataDiskService.createModataDisk(modataDisk);
    	return ajaxDoneSuccess("数据操作成功 ");
    }
	
	//@RequiresPermissions(value="modataDisk:loadModataDisk",desc="监控磁盘加载")
    @RequestMapping(value="/loadModataDisk/{id}", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
    public @ResponseBody  Object loadModataDisk(@PathVariable("id")Long id){
		Optional<ModataDisk> ops = modataDiskService.loadModataDiskById(id);
		return ajaxQuery("modataDisk",ops);
    }
	
	//@RequiresPermissions(value="modataDisk:updateModataDisk",desc="监控磁盘更新")
    @RequestMapping(value="/updateModataDisk", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
    public @ResponseBody  Object updateModataDisk(@RequestBody  ModataDisk modataDisk){
		modataDiskService.updateModataDisk(modataDisk);
		return ajaxDoneSuccess("数据操作成功 ");
    }
	
	//@RequiresPermissions(value="modataDisk:deletModataDisk",desc="监控磁盘删除")
    @RequestMapping(value="/deleteModataDisk/{id}", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
    public @ResponseBody  Object deleteModataDisk(@PathVariable("id")Long id){
		modataDiskService.deleteModataDisk(id);
		return ajaxDoneSuccess("数据操作成功 ");
    }


    @RequestMapping(value="/loadModataDiskSelectVo", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
    public @ResponseBody  Object loadModataDiskSelectVo(){
		 List<SelectVo>  ops = modataDiskService.loadModataDiskSelectVo("");
		return ajaxQuery("selectVo",ops);
    }
    
}